# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ReplicaPool.V1beta1.Model.Pool do
  @moduledoc """


  ## Attributes

  *   `autoRestart` (*type:* `boolean()`, *default:* `nil`) - Whether replicas in this pool should be restarted if they experience a failure. The default value is true.
  *   `baseInstanceName` (*type:* `String.t`, *default:* `nil`) - The base instance name to use for the replicas in this pool. This must match the regex [a-z]([-a-z0-9]*[a-z0-9])?. If specified, the instances in this replica pool will be named in the format <base-instance-name>-<ID>. The <ID> postfix will be a four character alphanumeric identifier generated by the service.

      If this is not specified by the user, a random base instance name is generated by the service.
  *   `currentNumReplicas` (*type:* `integer()`, *default:* `nil`) - [Output Only] The current number of replicas in the pool.
  *   `description` (*type:* `String.t`, *default:* `nil`) - An optional description of the replica pool.
  *   `healthChecks` (*type:* `list(GoogleApi.ReplicaPool.V1beta1.Model.HealthCheck.t)`, *default:* `nil`) - Deprecated. Please use template[].healthChecks instead.
  *   `initialNumReplicas` (*type:* `integer()`, *default:* `nil`) - The initial number of replicas this pool should have. You must provide a value greater than or equal to 0.
  *   `labels` (*type:* `list(GoogleApi.ReplicaPool.V1beta1.Model.Label.t)`, *default:* `nil`) - A list of labels to attach to this replica pool and all created virtual machines in this replica pool.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the replica pool. Must follow the regex [a-z]([-a-z0-9]*[a-z0-9])? and be 1-28 characters long.
  *   `numReplicas` (*type:* `integer()`, *default:* `nil`) - Deprecated! Use initial_num_replicas instead.
  *   `resourceViews` (*type:* `list(String.t)`, *default:* `nil`) - The list of resource views that should be updated with all the replicas that are managed by this pool.
  *   `selfLink` (*type:* `String.t`, *default:* `nil`) - [Output Only] A self-link to the replica pool.
  *   `targetPool` (*type:* `String.t`, *default:* `nil`) - Deprecated, please use target_pools instead.
  *   `targetPools` (*type:* `list(String.t)`, *default:* `nil`) - A list of target pools to update with the replicas that are managed by this pool. If specified, the replicas in this replica pool will be added to the specified target pools for load balancing purposes. The replica pool must live in the same region as the specified target pools. These values must be the target pool resource names, and not fully qualified URLs.
  *   `template` (*type:* `GoogleApi.ReplicaPool.V1beta1.Model.Template.t`, *default:* `nil`) - The template to use when creating replicas in this pool. This template is used during initial instance creation of the pool, when growing the pool in size, or when a replica restarts.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Deprecated! Do not set.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :autoRestart => boolean(),
          :baseInstanceName => String.t(),
          :currentNumReplicas => integer(),
          :description => String.t(),
          :healthChecks => list(GoogleApi.ReplicaPool.V1beta1.Model.HealthCheck.t()),
          :initialNumReplicas => integer(),
          :labels => list(GoogleApi.ReplicaPool.V1beta1.Model.Label.t()),
          :name => String.t(),
          :numReplicas => integer(),
          :resourceViews => list(String.t()),
          :selfLink => String.t(),
          :targetPool => String.t(),
          :targetPools => list(String.t()),
          :template => GoogleApi.ReplicaPool.V1beta1.Model.Template.t(),
          :type => String.t()
        }

  field(:autoRestart)
  field(:baseInstanceName)
  field(:currentNumReplicas)
  field(:description)
  field(:healthChecks, as: GoogleApi.ReplicaPool.V1beta1.Model.HealthCheck, type: :list)
  field(:initialNumReplicas)
  field(:labels, as: GoogleApi.ReplicaPool.V1beta1.Model.Label, type: :list)
  field(:name)
  field(:numReplicas)
  field(:resourceViews, type: :list)
  field(:selfLink)
  field(:targetPool)
  field(:targetPools, type: :list)
  field(:template, as: GoogleApi.ReplicaPool.V1beta1.Model.Template)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.ReplicaPool.V1beta1.Model.Pool do
  def decode(value, options) do
    GoogleApi.ReplicaPool.V1beta1.Model.Pool.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ReplicaPool.V1beta1.Model.Pool do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
